import apiMap from "@/constants/api";
import request from "@/helper/request/request";
import { combineParams } from "@/helper/utils";

/**
 * 获取省市区
 * @param params
 */
export const commonCityApi = () => request(apiMap.commonCity);
/**
 * 获取首页广告
 * @param params
 */
export const classifyAddIndexGetApi = () => request(apiMap.getIndexImage);
/**
 * 获得全部分类
 * @param params
 */
export const classifyListApi = (params: any) =>
  request(apiMap.classifyList, params);
/**
 * 删除分类
 * @param params
 */
export const classifyDeleteApi = (params: any) =>
  request({
    ...apiMap.classifyDelete,
    url: combineParams(apiMap.classifyDelete.url, params),
  });
/**
 * 获取分类详情
 * @param params
 */
export const classifyDetailApi = (params: any) =>
  request(apiMap.classify, params);

export const indexGetDetailApi = (params: any) =>
  request(apiMap.indexGetDetail, params);
/**
 * 添加分类
 * @param params
 */
export const classifyPostApi = (params: any) =>
  request(apiMap.classifyPost, params);
/**
 * 获取工具列表
 * @param params
 */
export const getToolApi = (params: any) => request(apiMap.index, params);
/**
 * 获取合作平台
 * @param params
 */
export const getPlatformApi = (params: any) =>
  request(apiMap.getPlatform, params);
/**
 * 删除合作平台
 * @param params
 */
export const cooperationPlatformDeleteApi = (params: any) =>
  request({
    ...apiMap.cooperationPlatformDelete,
    url: combineParams(apiMap.cooperationPlatformDelete.url, params),
  });
/**
 * 合作平台详情
 * @param params
 */
export const cooperationPlatformDetailApi = (params: any) =>
  request(apiMap.cooperationPlatformDetail, params);
/**
 * 添加合作平台
 * @param params
 */
export const addPlatformApi = (params: any) =>
  request(apiMap.addPlatform, params);
/**
 * 获取动态
 * @param params
 */
export const talkGetApi = (params: any) => request(apiMap.talkGet, params);
/**
 * 新增动态
 * @param params
 */
export const talkPostApi = (params: any) => request(apiMap.talkPost, params);

/**
 * 删除动态
 * @param params
 */
export const talkDeleteApi = (params: any) =>
  request({
    ...apiMap.talkDelete,
    url: combineParams(apiMap.talkDelete.url, params),
  });

export const addIndexCountApi = () => request(apiMap.addIndexCount);

export const addCountApi = (params: any) => request(apiMap.addCount, params);
export const useInfoApi = (params: any) => request(apiMap.useInfo, params);
export const wxLoginApi = (params: any) => request(apiMap.wxLogin, params);
export const getPhoneApi = (params: any) => request(apiMap.getPhone, params);
export const authStoreApi = (params: any) => request(apiMap.authStore, params);
export const deleteAdApi = (params: any) =>
  request({
    ...apiMap.deleteAd,
    url: combineParams(apiMap.deleteAd.url, params),
  });
export const insertAdApi = (params: any) => request(apiMap.insertAd, params);
export const updateAdApi = (params: any) => request(apiMap.updateAd, params);
export const getQrCodeApi = (params: any) => request(apiMap.getQrCode, params);
export const getAdApi = () => request(apiMap.getAd);
export const getAdListApi = () => request(apiMap.getAdList);
export const getPlatformCountApi = () => request(apiMap.getPlatformCount);
export const getCollectionApi = (params: any) =>
  request(apiMap.getCollection, params);
export const delAdvertisementApi = (params: any) =>
  request({
    ...apiMap.delAdvertisement,
    url: combineParams(apiMap.delAdvertisement.url, params),
  });
export const classifyAddIndexPostApi = (params: any) =>
  request(apiMap.classifyAddIndexPost, params);
export const getUserInfoApi = (params: any) =>
  request({
    ...apiMap.getUserInfo,
    url: combineParams(apiMap.getUserInfo.url, params),
  });
export const addStoreApi = (params: any) => request(apiMap.addStore, params);
export const storeBizApi = (params: any) => request(apiMap.storeBiz, params);
export const storeDisableApi = (params: any) =>
  request({
    ...apiMap.storeDisable,
    url: combineParams(apiMap.storeDisable.url, params),
  });
export const getStoreAPi = (params: any) => request(apiMap.getStore, params);
export const indexFindApi = (params: any) =>
  request({
    ...apiMap.indexFind,
    url: combineParams(apiMap.indexFind.url, params),
  });
export const getAccessTokenAPi = (params: any) =>
  request(apiMap.getAccessToken, params);
export const getWxCodeApi = (token: string, params: any) =>
  request(
    {
      ...apiMap.getWxCode,
      url: combineParams(apiMap.getWxCode.url, { access_token: token }),
    },
    params
  );
export const getStoreViewCountApi = (params: any) =>
  request(apiMap.getStoreViewCount, params);
export const collectionStoreApi = (params: any) =>
  request(apiMap.collectionStore, params);
export const storeDeleteApi = (params: any) =>
  request({
    ...apiMap.storeDelete,
    url: combineParams(apiMap.storeDelete.url, params),
  });
export const getStoreDetailApi = (params: any) =>
  request({
    ...apiMap.getStoreDetail,
    url: combineParams(apiMap.getStoreDetail.url, params),
  });
